package thread;

/**
 * 获取线程信息的相关方法
 */
public class ThreadInfoDemo {
    public static void main(String[] args) {
       Thread main=Thread.currentThread();
       String name= main.getName(); //获取线程名字
        System.out.println("名字:"+name);//名字:main

        long id= main.getId();//获取唯一标识
        System.out.println("id:"+id);//id:1

        boolean isAlive=main.isAlive();//是否活着
        System.out.println(isAlive);

        boolean isDaemon=main.isDaemon();//是否是守护线程
        System.out.println(isDaemon);

      boolean isInterrupted= main.isInterrupted();//是否被中断
        System.out.println(isInterrupted);



    }
}
